<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>浏览线下实践</title>
    <style>
        :root {
            --sidebar-width: 240px; --primary-color: #007bff;
            --border-color: #dee2e6; --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
            background-color: #f4f5f7; margin: 0; color: #333;
        }
        .main-content { margin-left: var(--sidebar-width); padding: 30px; }
        .container-card {
            background-color: #ffffff; border-radius: 8px;
            box-shadow: var(--card-shadow); padding: 25px 30px;
        }
        .page-header {
            margin: 0 0 25px 0; padding-bottom: 20px;
            border-bottom: 1px solid var(--border-color); font-size: 1.8em; color: #333;
        }
        .practice-list { display: flex; flex-direction: column; gap: 20px; }
        .practice-card {
            display: flex; justify-content: space-between; align-items: center;
            padding: 20px; border: 1px solid #eee; border-radius: 8px;
            background-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }
        .practice-card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow); }
        .practice-details h3 { font-size: 1.25em; margin: 0 0 10px 0; }
        .practice-details p { font-size: 0.9em; color: #6c757d; margin: 4px 0; }
        .btn {
            display: inline-block; padding: 10px 20px; color: white; text-decoration: none;
            border-radius: 5px; background-color: var(--primary-color);
            font-weight: 500; transition: background-color 0.2s;
        }
        .btn:hover { background-color: #0056b3; }
        .info-box { text-align: center; padding: 40px; color: #666; background-color: #fafafa; border: 1px dashed #ccc; border-radius: 8px; }
    </style>
</head>
<body>
<div th:replace="~{fragments/header :: header}"></div>

<div class="main-content">
    <div class="container-card">
        <h1 class="page-header">浏览线下实践</h1>
        <div class="practice-list">
            <div th:each="p : ${practices}" class="practice-card">
                <div class="practice-details">
                    <h3 th:text="${p.title}"></h3>
                    <p><strong>课程:</strong> <span th:text="${p.courseName}"></span></p>
                    <p><strong>时间:</strong> <span th:text="${#temporals.format(p.practiceTime, 'yyyy-MM-dd HH:mm')}"></span></p>
                    <p><strong>地点:</strong> <span th:text="${p.location}"></span></p>
                </div>
                <a th:href="@{/student/practice/view/{id}(id=${p.id})}" class="btn">查看详情并报名</a>
            </div>
        </div>
        <div th:if="${#lists.isEmpty(practices)}" class="info-box">
            <p>当前没有可报名的线下实践活动。</p>
        </div>
    </div>
</div>
</body>
</html>